<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
	<style>
		div{
			width:500px;
			height:300px;
			border:1px solid red;
		}
	</style>
</head>
<body>
<input type="text">
<div></div>
</body>
<script>
	const inp = document.querySelector("input");
	const div = document.querySelector("div");
	const data = {
		str:"你现在好吗？现在快乐吗？"
	}
	inp.value = div.innerHTML =data.str;
	let _str = data.str;
	Object.defineProperty(data,"str",{
		get(){
			return _str;
		},
		set(v){
			_str = inp.value = div.innerHTML = v;
		}
	})
	inp.oninput = function(){
		data.str = div.innerHTML = this.value;
	}
	
</script>
</html>